home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 138
/
Volume 138 Aug 19 2011 - Damaged.iso
/
Games
/
shadez.swf
/
scripts
/
Local
/
Draw
/
CBitmapStrip.as
next >
Wrap
Text File
|
2011-08-19
|
8KB
|
265 lines
package Local.Draw
{
import flash.display.BitmapData;
import flash.events.EventDispatcher;
import flash.geom.Point;
import flash.geom.Rectangle;
public class CBitmapStrip extends EventDispatcher
{
public static const mDefaultWidth:int = 50;
public static const zPoint:Point = new Point(0,0);
public static const mDefaultWidthScalar:Number = 1 / mDefaultWidth;
public var mBackground:Boolean;
public var mBMD:BitmapData;
public var mDisplacementLow:int;
public var mDisplayRect:Rectangle;
public var mFineAltitudes:Array;
public var mDisplacement:int;
public var mName:String;
public var mAltitudes:Array;
public var mNext:CBitmapStrip;
public var mOpaque:Boolean;
public function CBitmapStrip(param1:String, param2:BitmapData, param3:Boolean = false, param4:Boolean = false)
{
if(true)
{
super();
if(true)
{
mBackground = param3;
if(true)
{
mName = param1;
}
mOpaque = param4;
}
ScanBitmap(param2);
}
}
public function ScanAltitudes() : void
{
var _loc1_:int = 0;
var _loc2_:int = 0;
var _loc3_:int = 0;
var _loc4_:int = 0;
var _loc5_:int = 0;
if(true)
{
mAltitudes = new Array();
if(true)
{
mFineAltitudes = new Array();
if(true)
{
if(mOpaque)
{
§§goto(addr35);
}
else
{
_loc5_ = 0;
if(true)
{
_loc3_ = 0;
if(true)
{
§§goto(addr155);
}
§§goto(addr136);
}
}
§§goto(addr148);
}
addr35:
_loc2_ = 0;
§§goto(addr37);
}
addr37:
_loc3_ = 0;
§§goto(addr39);
}
addr39:
loop6:
while(true)
{
if(_loc3_ >= mBMD.width)
{
if(false)
{
loop1:
for(; _loc4_ < mBMD.height; _loc4_++)
{
var _loc6_:*;
§§push(_loc6_ = mBMD.getPixel32(_loc3_,_loc4_) >>> 24);
if(true)
{
_loc1_ = §§pop();
§§push(_loc6_);
}
while(true)
{
if(§§pop() == 0)
{
continue loop1;
}
while(true)
{
mAltitudes[_loc3_] = _loc4_ + mDisplacement;
addr136:
while(true)
{
mFineAltitudes[_loc3_] = _loc4_ + mDisplacement + (1 - _loc1_ / 255);
addr148:
while(true)
{
break loop1;
}
}
}
}
}
loop5:
while(true)
{
_loc3_++;
addr155:
while(_loc3_ < mBMD.width)
{
_loc4_ = 0;
if(true)
{
§§goto(addr150);
}
§§goto(addr130);
continue loop5;
}
}
addr150:
addr154:
}
addr159:
mDisplacementLow = 0;
addr162:
_loc6_ = 0;
if(true)
{
var _loc7_:* = mAltitudes;
if(true)
{
}
for each(_loc1_ in _loc7_)
{
mDisplacementLow = _loc1_ > mDisplacementLow ? int(_loc1_) : int(mDisplacementLow);
}
}
addr192:
§§push((_loc6_ = §§findproperty(mDisplacementLow)).mDisplacementLow);
if(true)
{
§§push(§§pop() + 1);
}
_loc7_ = §§pop();
if(true)
{
_loc6_.mDisplacementLow = _loc7_;
}
break;
}
_loc4_ = mBMD.height - 1;
if(true)
{
while(true)
{
if(_loc4_ >= 0)
{
§§push(mBMD.getPixel32(_loc3_,_loc4_) >>> 24);
if(true)
{
if(§§pop() != 255)
{
if(true)
{
mAltitudes[_loc3_] = _loc4_ + mDisplacement;
if(true)
{
§§goto(addr81);
}
§§goto(addr162);
}
§§goto(addr192);
}
else
{
_loc4_--;
if(true)
{
continue;
}
}
}
break;
}
if(true)
{
addr81:
_loc3_++;
if(true)
{
continue loop6;
}
§§goto(addr154);
}
§§goto(addr155);
§§goto(addr159);
}
§§goto(addr128);
}
break;
§§goto(addr128);
}
}
public function ScanBitmap(param1:BitmapData) : void
{
var _loc2_:Rectangle = null;
_loc2_ = param1.getColorBoundsRect(4278190080,0,false);
if(true)
{
mDisplayRect = new Rectangle(0,_loc2_.y,CBitmapStrip.mDefaultWidth,Math.max(1,_loc2_.height));
if(true)
{
mDisplacement = mDisplayRect.y;
if(true)
{
mBMD = new BitmapData(mDisplayRect.width,mDisplayRect.height,true,0);
}
mBMD.copyPixels(param1,mDisplayRect,zPoint,null,null,true);
}
ScanAltitudes();
}
}
public function get mMemSize() : uint
{
return mBMD.width * mBMD.height * 4;
}
}
}